package com.flying.invest.account.model;

import java.util.Date;

import com.flying.common.util.Codes;
import com.flying.framework.annotation.ConstantEnum;
import com.flying.framework.annotation.Param;
import com.flying.framework.data.Data;
import com.flying.framework.data.DataSerializable;
import com.flying.framework.metadata.Meta;

@SuppressWarnings("serial")
@Meta(id="i_account",title="账户", table="i_account", primaryKeys={"account_id"})
public class Account extends Data implements DataSerializable {
	public final static String ENTITY_NAME = "i_account";
	
	public final static String ACCOUNT_ID = "account_id";
	public final static String USER_ID = "user_id";
	public final static String NAME = "name";
	public final static String REMARKS = "remarks";
	public final static String ACCOUNT_TYPE = "account_type";
	public final static String CURRENCY = "currency";
	public final static String AMOUNT = "amount";

	public final static String SHARES = "shares";
	public final static String NET_VALUE = "net_value";
	public final static String TOTAL_AMOUNT = "total_amount";
	
	public final static String CREATOR = "creator";
	public final static String CREATE_TIME = "create_time";
	public final static String UPDATOR = "updator";
	public final static String UPDATE_TIME = "update_time";
	
	
	@Param(value=ACCOUNT_ID,   required=true,   desc="账户ID" , generator=Codes.AUTO_INCREMENT)
	private Long accountId;
	
	@Param(value=USER_ID,   required=true,   desc="所属用户" )
	private Long userId;
	
	@Param(value=NAME,   required=false,   maxlength=50,	desc="名称" )
	private String name;
	
	@Param(value=REMARKS,   required=false,   maxlength=400,	desc="说明" )
	private String remarks;
	
	@Param(value=ACCOUNT_TYPE,   required=false,   desc="账户类型", enumClass = AccountType.class )
	private Integer accountType;
	
	@Param(value=CURRENCY,   required=false,   maxlength=10,	desc="币种" )
	private String currency;
	
	@Param(value=AMOUNT,   required=false,   desc="余额" )
	private Double amount;
	
	@Param(value=SHARES,   required=false,   desc="份额" )
	private Double shares;
	
	@Param(value=NET_VALUE,   required=false,   desc="净值" )
	private Double netValue;
	
	@Param(value=TOTAL_AMOUNT,   required=false,   desc="总额(RMB)" )
	private Double totalAmount;
	
	@Param(value=CREATOR,   required=false,   maxlength=40,	desc="创建人" )
	private String creator;
	
	@Param(value=CREATE_TIME,   required=false,   desc="创建时间" )
	private Date createTime;
	
	@Param(value=UPDATOR,   required=false,   maxlength=40,	desc="修改人" )
	private String updator;
	
	@Param(value=UPDATE_TIME,   required=false,   desc="修改时间" )
	private Date updateTime;
	
	public enum AccountType implements ConstantEnum<Integer> {
		CASHIER(1, "现金"), INVEST(2, "投资");

		public final int value;
		public final String remarks;

		AccountType(int value, String remarks) {
			this.value = value;
			this.remarks = remarks;
		}
		
		@Override
		public Integer value() {
			return this.value;
		}

		@Override
		public String text() {
			return remarks;
		}
		
	}
	
	public Long getAccountId() {
		return this.accountId;
	}
	
	public void setAccountId(Long accountId) {
		this.accountId = accountId;
	}
	
	public Long getUserId() {
		return this.userId;
	}
	
	public void setUserId(Long userId) {
		this.userId = userId;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public Integer getAccountType() {
		return this.accountType;
	}
	
	public void setAccountType(Integer accountType) {
		this.accountType = accountType;
	}
	
	public String getCurrency() {
		return this.currency;
	}
	
	public void setCurrency(String currency) {
		this.currency = currency;
	}
	
	public Double getAmount() {
		return this.amount;
	}
	
	public void setAmount(Double amount) {
		this.amount = amount;
	}
	
	public Double getShares() {
		return shares;
	}

	public void setShares(Double shares) {
		this.shares = shares;
	}

	public Double getNetValue() {
		return netValue;
	}

	public void setNetValue(Double netValue) {
		this.netValue = netValue;
	}

	public Double getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(Double totalAmount) {
		this.totalAmount = totalAmount;
	}

	public String getCreator() {
		return this.creator;
	}
	
	public void setCreator(String creator) {
		this.creator = creator;
	}
	
	public Date getCreateTime() {
		return this.createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public String getUpdator() {
		return this.updator;
	}
	
	public void setUpdator(String updator) {
		this.updator = updator;
	}
	
	public Date getUpdateTime() {
		return this.updateTime;
	}
	
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	

}